﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Problem_2
{
    class Program
    {
        static bool isPrime(int number)//质数判断
        {
            if (number <= 1)
                return false;
            if (number == 2)
                return true;
            if (number >= 3)
            {
                for (int i = 2; i < number; i++)
                {
                    if (number % i == 0)
                        return false;
                }
            }
            return true;
        }
        static void Main(string[] args)
        {
            Console.Write("请输入要判断的数:");
            int number;
            number = int.Parse(Console.ReadLine());
            Console.WriteLine("它的质因数有:");
            for (int i = 1; i <= number; i++)
            {
                if (number % i == 0 && isPrime(i))
                {

                    Console.WriteLine(i);

                }
            }
            Console.ReadKey();
        }
    }
}
